<?
include_once("_common.php");
include_once("$mw_cash[path]/cybercash.lib.php");

if (!$is_member)
    alert_close("로그인 후 이용해주세요.");

if (!$mw_cash[cf_point])
    alert_close("포인트 전환기능이 활성화되어 있지 않습니다.");

if ($mw_cash['cf_point_level'] && $mw_cash['cf_point_level'] > $member['mb_level'])
    alert_close("회원권한 {$mw_cash['cf_point_level']}레벨 이상 변환 가능합니다.");

$point = mw_get_point_to_cash_possible();
$cash = floor($point / $mw_cash[cf_cash_point]);

if ($point < $mw_cash[cf_point_min])
    alert_close(number_format($mw_cash[cf_point_min])." 포인트 이상되야 $mw_cash[cf_cash_name] 전환이 가능합니다.");

$g4[title] = "포인트→$mw_cash[cf_cash_name] 전환";
include_once("$g4[path]/head.sub.php");
?>

<style type="text/css">
body { padding:10px; }
h3 { font-size:15px; }
.point-info { border:5px solid #efefef; padding:20px; font-weight:bold; text-align:center; font-size:13px; }
td.head { border-bottom:1px solid #ddd; padding:15px 10px 0 0; font-weight:bold; }
td.body { border-bottom:1px solid #ddd; padding:10px; }
.btn1 { background-color:#efefef; cursor:pointer; }
.hints { color:#888; margin:5px 0 5px 0; }
.blue { color:#0D6AB2; }
.button { text-align:center; margin:30px 0 30px 0; }
#payment-info { color:#888; }
</style>

<script type="text/javascript">
function form_submit() {
    if (confirm('정말 전환하시겠습니까?'))
	return true;
    else
	return false;
}
</script>

<h3>포인트→<?=$mw_cash[cf_cash_name]?> 전환</h3>

<form name="fwrite" method="post" action="point-to-cash-update.php" onsubmit="return form_submit()">
<div class="point-info">
    나의 가용포인트 : <span class="blue"><?=number_format($point)?></span> 점 (최대 <?=$cash?> <?=$mw_cash[cf_cash_unit]?> 가능)<br/><br/> →
    <?=$mw_cash[cf_cash_name]?>
    <input type="text" size="10" name="point_to_cash" required numeric itemname="<?=$mw_cash[cf_cash_name]?>" value="" class="ed" onkeydown="if (event.keyCode==13) return false;" onkeyup="how_much_cash_charge()">
    <?=$mw_cash[cf_cash_unit]?> 전환
    <? /* ?>
    <select name="point_to_cash" required itemname="<?=$mw_cash[cf_cash_name]?>">
    <? for ($i=1; $i<=$cash; $i++) { ?>
    <option value="<?=$i?>"> <?=$mw_cash[cf_cash_name]?> <?=$i?> <?=$mw_cash[cf_cash_unit]?></option>
    <? } ?>
    </select> 
    <? */?>
</div>

<div class="button">
<input type="submit" value="확    인" class="btn1">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="취    소" class="btn1" onclick="self.close()">
</div>
</form>

<? if ($mw_cash[cf_possible_day]) { ?><div class="hints">※ 가용포인트란 <?=$mw_cash[cf_possible_day]?>일 전까지 적립된 포인트를 말합니다.</div> <? } ?>
<? if ($mw_cash[cf_point_min]) {?><div class="hints">※ <?=number_format($mw_cash[cf_point_min])?> 포인트 이상부터 전환 가능합니다.</div><? } ?>
<div class="hints">※ <?="$mw_cash[cf_cash_name] 1$mw_cash[cf_cash_unit] 당 포인트 ".number_format($mw_cash[cf_cash_point])." 점"?></div>
<div class="hints">※ <?=$mw_cash[cf_cash_name]?>→포인트로는 전환되지 않습니다.</div>

<?
include_once("$g4[path]/tail.sub.php");
?>
